/**
 * Created with JetBrains WebStorm.
 * User: Fred_974
 * Date: 08/03/13
 * Time: 23:07
 * To change this template use File | Settings | File Templates.
 */
/**
 * Created with JetBrains WebStorm.
 * User: Fred_974
 * Date: 08/03/13
 * Time: 22:56
 * To change this template use File | Settings | File Templates.
 */
/**
 * Created with JetBrains WebStorm.
 * User: Fred_974
 * Date: 08/03/13
 * Time: 22:42
 * To change this template use File | Settings | File Templates.
 */

var Building = function Building(rawObject){

    this.type = rawObject.type;
    this.price = rawObject.price;
    this.storage = rawObject.storage;
    this.tile = rawObject.tile;


}

Building.prototype = {
    initialize : function() {
        this.id;

            this.type,
            this.price,
            this.storage,
            this.tile
    },


    init : function(parameters){
        this.id = parameters.id;

        this.type = parameters.type;
        this.price = parameters.price;
        this.storage = parameters.storage;



        if(parameters.tile == null){
            this.tile = null;
        }else{

            this.tile = parameters.tile;
        }


    },

    getTileForPersist : function(){


        if(this.tile == null){

            return null;
        }
        if(this.tile.id == undefined){

            return this.tile;
        }else{
            return this.tile.id;
        }
    }

}
//coco
module.exports = Building;